const { nullAddress } = require('../helper/unwrapLPs')

const config = {
  arbitrum: {
    mvts: ['0x5E851dC1f56A05Bb6d3C053FA756304a5171C345', '0x04901268EE65E989852370C0bad08E1514a0C484', '0x9eDC0ea75e6023b93bbB41c16818e314cfE59D2b', '0xEC38621e72D86775a89C7422746de1f52bbA5320', '0x30aCD3e86f42Fcc87c6FB9873058d8d7133785d4', '0x394fdEC30250A38869bcB425F96080eD6c1b756a', '0xafCA20A243e4e4936fAF76e8893128A231678677'],
  },
  bsc: {
    mvts: ['0x4e90156997BB469c6F5975e13FF1451C9500B711', '0x87ad5Ab05d7C1E1F904e029783810A2a95702563', '0xb44A251d1C31dd32700E5F2584B4282716C43EB3'],
  },
  ethereum: {
    mvts: ['0xb396b31599333739A97951b74652c117BE86eE1D', '0x97f0BdaDbfAA05a1944fFbA862b3336a175056cF', '0xC5A7bEB1E6c61B3Aa8dF5aD32a17eb5e9B974B98', '0xf824c280De7622E468547E2d3eca7C94Ad8d7169', '0x4d7CabA383F017c4ce8B1F4493482eC0f09c9Ae7', '0x7281d1bCcbe34574Ee6507b3f4816AFBe85A2e3d', '0xD9dbd69974733481eeCD0125898C8Bb63c51f783', '0xc7b219a9A8e246f9C4d4A1c7d4a371F0840ff724', '0xd4E426ABA74Ece196D375e01b53A70ebeA51Cf25', '0x591e68e32eF0fbFc2DbC5916cd70fEFBF3a9F136', '0x7E6173fE3b426755B4B961c6a7686c13E3c82883', '0x0730BA2252670Cd71580dadf471f3E137592e800', '0x47F661404716C3BB35B80C557e13F0EF490bC4Ae', '0xa6466b9827AD5D765579E3Fc9ca0d678C423fB53'],
  },
  optimism: {
    mvts: ['0x9c44E6A927302dA33dd76abe4558f26e31C48019', '0xb44A251d1C31dd32700E5F2584B4282716C43EB3'],
  },
  polygon: {
    mvts: ['0x77F4C841cb87fDFa43aB909cf56f7710Af648a8e', '0x9a1275304960dbc6a8d4a5795832823a7d53f30a'],
  },
  polygon_zkevm: {
    mvts: ['0x687B069759b053866715542f22877DA9091f20f5', '0x93402F1908dD009C857962b45278E71C7F63647f', '0x24318b8a0CBaCc61cAdE47e5457Eea7237EB2c0E'],
  },
  mode: {
    mvts: ['0xafCA20A243e4e4936fAF76e8893128A231678677', '0xbD38B722480e2e3D540CaFC44A113d92E1015faa', '0xFdC5033b6Ef5DEDc6b5225B3Fbe3704C3F9638eE', '0xbfE8c19642929Ea9FfD1754e8DdAb880F05022f1'],
  },
  linea: {
    mvts: ['0x7CDb0b6217A568947D3A2585F0E8AF135017d608', '0xd9BE9956C822000cc0078C16C66B7dd83E6E07C4', '0x2770cB901e6d990B4F5C35E0732821eBf9d3acb7', '0x4F50E7D6A48D78D813775d7A36717DA6A058811D'],
  },
}


Object.keys(config).forEach(chain => {
  const { mvts,} = config[chain]
  module.exports[chain] = {
    tvl: async (api) => {
      if (chain === 'polygon') {
        const token = '0x77F4C841cb87fDFa43aB909cf56f7710Af648a8e'
        const deposits = await api.call({  abi: 'function deposits(address) view returns (uint256)', target: '0xdd0BdF5749e300f946cdb1dDFE1ffa828eC0dB72', params: token })
        api.add(nullAddress, deposits)
      }
      const assets = await api.multiCall({  abi: 'address:asset', calls: mvts})
      return api.sumTokens({ tokensAndOwners2: [assets, mvts]})
    }
  }
})